package com.varian.tool.model;

import com.baomidou.mybatisplus.annotation.EnumValue;
import com.fasterxml.jackson.annotation.JsonValue;
import com.varian.tool.Func;
import com.varian.tool.enums.BaseEnum;
import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * @author ben
 * @since 2024/12/11
 */
@Getter
@RequiredArgsConstructor
public enum TaskStatus implements BaseEnum<TaskStatus> {
    // 未执行
    NOT_EXECUTED(0),
    // 执行中
    EXECUTING(1),
    // 成功
    SUCCESS(2),
    // 失败
    FAILURE(3);
    @JsonValue
    @EnumValue
    final Integer value;

    @Override
    public TaskStatus convert(Integer value) {
        return Func.findBaseEnumByValue(values(), value);
    }
}